package vn.lumi.smarthome;

import java.util.Locale;
import android.content.Context;
import android.content.res.Configuration;
import android.widget.Toast;

public class Config {
	public static final boolean DEBUG = true;
	public static final String DATABASE_NAME = "smarthome";
	public static boolean isVibrate = false;

	// public static final int LANGUAGE_AUTO = 1;
	public static final int LANGUAGE_VIETNAM = 2;
	public static final int LANGUAGE_ENGLISH = 3;
	
	
	private static Toast mToast = null;

	public static void showToast(Context mContext, String text) {
		if (mToast != null) {
			mToast.cancel();
			mToast = null;
		}
		mToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
		mToast.show();
	}

	/**
	 * @param mContext
	 *            : Gia tri cua ham getBaseContext
	 */
	public static void configLanguage(Context mContext, int language) {
		String suffix = null;
		Locale locale = null;
		if (language == LANGUAGE_VIETNAM)
			suffix = "vi";

		else
			suffix = "en";

		Configuration config = new Configuration();
		locale = new Locale(suffix);
		Locale.setDefault(locale);
		config.locale = locale;
		mContext.getResources().updateConfiguration(config,
				mContext.getResources().getDisplayMetrics());
	}
}
